package com.xiaoshuidi.cloud.module.member.api.coupon;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.member.api.coupon.vo.*;
import com.xiaoshuidi.cloud.module.member.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

/***
 * @author leo.li
 * @date 2023-06-07 21:20:24
 */

@FeignClient(name = ApiConstants.SERVERNAME)
@Tag(name = "RPC 服务 - 优惠券")
public interface CouponApi {
    String PREFIX = ApiConstants.PREFIX + "/coupon";


    @PostMapping(PREFIX + "/send-coupon-by-business")
    @Operation(summary = "根据业务触发优惠券发放")
    void sendCouponByBusiness(@RequestBody SendCouponByBusinessVo vo);

//    @PostMapping(PREFIX + "/check-bill-coupons")
//    @Operation(summary = "优惠券使用校验")
//    CommonResult<CouponCheckRespVo> checkBillCoup ons(@RequestBody CouponCheckReqVo reqVo);

    /**
     * 优惠券锁定
     * @param couponLockVo
     * @return
     */
    @PostMapping(PREFIX + "/coupons-add-lock")
    @Operation(summary = "优惠券锁定")
    CommonResult<List<CouponUpdateReturn>> couponAddLock(@RequestBody @Valid CouponLockVo couponLockVo);

    /**
     * 优惠卷解锁
     * @param couponUnLockVo
     * @return
     */
    @PostMapping(PREFIX + "/coupons-untie-lock")
    @Operation(summary = "优惠卷解锁")
    CommonResult<Boolean> couponUntieLock(@RequestBody CouponUnLockVo couponUnLockVo);

    /**
     * 支付成功时更新优惠卷
     * @param couponUpdateVos
     * @return
     */
    @PostMapping(PREFIX + "/coupons-update")
    @Operation(summary = "支付成功时更新优惠卷")
    CommonResult<Boolean> updateCoupon(@RequestBody List<CouponUpdateVo> couponUpdateVos);

    @PostMapping(PREFIX + "/coupons-return")
    @Operation(summary = "优惠券优惠信息返回")
    CommonResult<CouponReturn> couponReturn(@RequestBody CouponLockVo couponLockVo);


}
